package cnu.cse.crawler.xedata;

import java.util.ArrayList;

public class XeDocument 
{
	public static final int TYPE_UNKNOWN = 0;
	public static final int TYPE_NOTICE = 1;
	public static final int TYPE_LOCKED = 2;
	public static final int TYPE_DELETED = 3;
	public static final int TYPE_NORMAL = 4;
	public static final int TYPE_NEWEST = 5;

	private int number;
	private String path;
	private int type;
	private String title;
	private String date; // YYYYmmDD)
	private String time; // (HHmmSS)
	private String writerId;
	private String writerNickname;
	private int commentCount;
	private int readCount;
	private String contentsSummary;
	private String ipAddress;
	private String contents;
	private ArrayList<XeAttachedFile> attachedFiles;
	
	public XeDocument(int number, String path, int type, String title, String date, String time, String writerId, String writerNickname, int commentCount, int readCount, String contentsSummary)
	{
		this.number = number;
		this.path = path;
		this.type = type;
		this.title = title;
		this.date = date;
		this.time = time;
		this.writerId = writerId;
		this.writerNickname = writerNickname;
		this.commentCount = commentCount;
		this.readCount = readCount;
		this.contentsSummary = contentsSummary;
		this.ipAddress = "";
		this.contents = "";
		this.attachedFiles = new ArrayList<XeAttachedFile>();
	}
	
	public int getNumber() 
	{
		return number;
	}

	public String getPath() 
	{
		return path;
	}

	public int getType() 
	{
		return type;
	}

	public String getTitle() 
	{
		return title;
	}

	public String getDate() 
	{
		return date;
	}

	public String getTime() 
	{
		return time;
	}

	public String getWriterId() 
	{
		return writerId;
	}

	public String getWriterNickname() 
	{
		return writerNickname;
	}

	public int getCommentCount() 
	{
		return commentCount;
	}

	public int getReadCount() 
	{
		return readCount;
	}

	public String getContentsSummary() 
	{
		return contentsSummary;
	}
	
	public String getIpAddress() 
	{
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) 
	{
		this.ipAddress = ipAddress;
	}
	
	public String getContents() 
	{
		return contents;
	}

	public void setContents(String contents) 
	{
		this.contents = contents;
	}
	
	public boolean isAttachedFile()
	{
		if (attachedFiles.size() == 0)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	
	public int getAttachedFileCount()
	{
		return attachedFiles.size();
	}
	
	public void addAttachedFile(XeAttachedFile attachedFile)
	{
		attachedFiles.add(attachedFile);
	}
		
	public XeAttachedFile getAttachedFile(int index)
	{
		if (index > -1 && index < attachedFiles.size())
		{
			return attachedFiles.get(index);
		}
		
		return null;
	}
	
	
	
}
